$(function() {


    var data = localStorage.getItem("cardata")
    let load = axios.create({
        baseURL: "http://localhost:3000/static/data/"

    })

    function loadListData() {
        let options = {
            url: "/ind.json"
        }
        load(options)
            .then((res) => {
                var data = res.data
                for (let i = 0; i < data.length; i++) {
                    let location = data[i].id
                        // 获取商品在数据中的位置
                    var a = location.match(/a(\d?)/)[1];
                    var b = location.match(/b(\d+)/)[1];
                    let sum = data[i].sum



                    $("#detial").append(`<div class="shopcar ">
                    <div class="shop">
                        <div class="shangpin">
                            <input type="checkbox" name="check" class="input"  />
                            <div class="tp">
                                <img src="${data[a].data[b].majorPics}">
                            </div>
                            <p class="p1">${data[a].data[b].name}</p>


                            <div class="jj">
                                <p class="jian">-</p>
                                <p class="num">${sum}</p>
                                <p class="jia">+</p>
                            </div>
                            <p class="p4">￥</p>
                            <p class="p5" data_id="">
                                <img src="../static/img/lj.png" alt="">
                            </p>
                        </div>
                    </div>
                </div>`)
                }
            })
    }







})